<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="keywords" content="积分搜索">
  <meta name="description" content="积分搜索">
  <title>积分搜索</title>
   <link rel="stylesheet" type="text/css" href="<?php echo site_url(); ?>app/views/css/common.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo site_url(); ?>app/views/js/themes/bootstrap/easyui.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo site_url(); ?>app/views/js/themes/icon.css" />
 
  <script type="text/javascript" src="<?php echo site_url(); ?>app/views/js/jquery.min.js"></script>
  <script type="text/javascript" src="<?php echo site_url(); ?>app/views/js/jquery.easyui.min.js"></script>
 <script type="text/javascript" src="<?php echo site_url(); ?>app/views/js/locale/easyui-lang-zh_CN.js"></script>

 
</head>
<body>
<input type="hidden" id="site_url" value="<?php echo site_url(); ?>">
  <div id="emp" class="easyui-window" title="选择员工" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:800px;height:400px;padding:5px;top:10px;left:200px;">
 
<div class="" style="width:600px;height: 350px;float:right;border: solid 1px #CCC">
  <div class="" style="width: 100%;height: 35px;border:solid 0px #CCC">
  <div style="width: 19%;height: 29px;border: solid 0px #ccc;float:right;text-align: center"><button style="width: 100%;height: 110%" onclick="empsearch()">搜索</button></div>
    <div style="width: 80%;height: 29px;border: solid 0px #ccc;float:left"><input type="text" style="width: 100%;height: 90%;" id="empsearchvalue"></div>
    
  </div>
   <table id="emp_tt" class="easyui-datagrid" title="员工列表" style=""
            data-options="singleSelect:true,url:'<?php  echo site_url();?>index.php/search/get_emp',method:'get'">
        <thead>
            <tr>
                <th data-options="field:'id'" width="40">编码</th>
                <th data-options="field:'name'" width="100">员工名称</th>
                <th data-options="field:'address'" width="150">地址</th>
                <th data-options="field:'telphone'" width="100">联系电话</th>
                <th data-options="field:'departname'" width="100">所属部门</th>
                 <th data-options="field:'depart'" width="0"></th>
            </tr>
        </thead>
    </table>
</div>
<div class="" style="width:140px;height: 350px;float:left;border: solid 1px #CCC">
  
<ul class="easyui-tree" id="empcategory" data-options="url:'<?php  echo site_url();?>index.php/search/get_emp_category',method:'get',animate:true"></ul>
</div>
  </div>



<input type="hidden" id="site_url" value="<?php echo site_url(); ?>">
  <h2 class="navfont">积分搜索:</h2>
  
<table id="tt" class="easyui-datagrid" style="width:1200px;height:500px"
		url="" toolbar="#tb"
		title="" iconCls=""
		rownumbers="true" pagination="true">
	<thead>
		<tr>
			<th field="product_name" width="200">积分项目</th>
      <th field="score" width="90">积分对应值</th>
			<th field="product_num" width="100">积分数量</th>
			<th field="total" width="100" align="right">积分小计</th>
			<th field="time" width="150" align="right">获得积分时间</th>	
		</tr>
	</thead>
</table>

<div id="tb" style="padding:3px">
	<span>选择员工:</span>
	<input type="hidden" value="" id="empid">
  
	<input id="empname" style="line-height:18px;border:1px solid #ccc" onclick="emp()">
	<span>开始时间:</span>
	<input  value="" type="text" id="starttime"  class="easyui-datebox" >
	<span>结束时间:</span>
	<input  value="" type="text" id="endtime"  class="easyui-datebox" >
	<a href="#" class="easyui-linkbutton" plain="true" onclick="doSearch()">搜索</a>
</div>
 
<script type="text/javascript">
 function doSearch(){
  var empid=$("#empid").val();
  var starttime = $('#starttime').datebox('getValue');
 
  var endtime = $('#endtime').datebox('getValue');
  var site_url=$("#site_url").val();

  var url=site_url+"index.php/search/get_score/?empid="+empid+"&starttime="+starttime+"&endtime="+endtime;
    $('#tt').datagrid('options').url=url;  
  $('#tt').datagrid('reload');
}
   function emp(){
   
    $('#emp').window('open');
  }
	
$('#empcategory').tree({
  onClick:function(row){
  var row = $('#empcategory').tree('getSelected');
  var id=row.id;

   var site_url=$("#site_url").val();
  var url=site_url+"index.php/search/get_emp/?id="+id;
    $('#emp_tt').datagrid('options').url=url;  
  $('#emp_tt').datagrid('reload');
}});


$('#emp_tt').datagrid({
 onClickRow:function(row){
    var row=$("#emp_tt").datagrid('getSelected');
    var id=row.id;
    var name=row.name;
    //var code=row.code;
    var departname=row.departname;
    /* var address=row.address;*/
     var telphone=row.telphone;
     $("#empid").val(id);
     $("#empname").val(name);
      $('#emp').window('close');
 }});



	function empsearch(){
var empsearchvalue=$("#empsearchvalue").val();
 var site_url=$("#site_url").val();
  var url=encodeURI(site_url+"index.php/search/get_emp_search/?key="+empsearchvalue);
 $('#emp_tt').datagrid('options').url=url;    
  $('#emp_tt').datagrid('reload');
}

</script>
</body>
</html>